FROM eclipse-temurin:21-jre as builder
WORKDIR app
COPY target/*.jar          /app/app.jar
RUN java -Djarmode=layertools -jar app.jar extract

FROM eclipse-temurin:21-jre
MAINTAINER he_pengju@163.com
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" > /etc/timezone

WORKDIR app/springboot
COPY --from=builder app/dependencies/           ./
COPY --from=builder app/spring-boot-loader/     ./
COPY --from=builder app/snapshot-dependencies/  ./
COPY --from=builder app/application/            ./

COPY front/dist            /app/static
COPY docs/hepengju.com.jks /app/cert/hepengju.com.jks

EXPOSE 443
EXPOSE 80

ENTRYPOINT java ${JAVA_OPTS} ${JAVA_AGENT} -cp /app/springboot org.springframework.boot.loader.launch.JarLauncher

# docker build -t mock-data:3.5 .
# docker tag mock-data:3.5 hepengju/mock-data:3.5
# docker push hepengju/mock-data:3.5
# docker run -d --name mockdata35 -p 443:443 -p 80:80 -e "JAVA_OPTS=-Xms250M -Xmx1G" --restart=always hepengju/mock-data:3.5
# docker exec -it mockdata35 bash
# docker rm -f mockdata35

# 域名过期后的重新设置：域名放在root的家目录，域名密码使用application.yaml中的替换下即可
# docker run -d --name mockdata35 -p 443:443 -p 80:80 -e "JAVA_OPTS=-Xms250M -Xmx1G" -v /root/hepengju.com.jks:/app/hepengju.com.jks -v /root/application.yaml:/app/application.yaml --restart=always hepengju/mock-data:3.5
